Skip to main content

dot Env

HAWKI 2: Configuration environment variables

HAWKI 2 is built with the Laravel framework for PHP. This allows to configure the application by editing the *.php files in the config directory. However, by default these files are written in such a way that most settings can also be changed with environment variables. This is handy because changing the config files would mean to change the HAWKI 2 source code, since these files are managed in the HAWKI git repository and also contained in the installation packages. Environment variables, however, are set in the OS (or your hosting environment).

Additionally, Laravel reads the contents of a .env file in the project root directory to override the environment variables. This file is not contained in the HAWKI installation as it is meant for developers and administrators to set their local configuration values.

This file is a template for the .env file. It documents all relevant settings, their allowed values and their defaults. Simply copy this file (don't just rename it) to a new file called .env and change the values as needed. The pre-set values will provide a sensible configuration for a "localhost deployment" for developers. Commented out settings are not strictly needed and usually contain the default values found in the config/*.php files.

Important: the .env example file includes several unused variables which are left in the file only for future development plans or as guidelines for community developers (such as AWS, Redis, Pusher and many more attributes). These variables can be ignored or removed if you prefer so.

Global Application Settings

VariableDefault ValueDescription
PROJECT_NAMEhawki2URL-safe name of the project (lowercase, no spaces, no special characters) used for naming docker containers
APP_NAMEHAWKI2Application name, can be anything you like
APP_ENVlocalDeployment type: "local", "staging" or "production"
APP_URLhttp://127.0.0.1:8000Public URL to access the web interface
APP_DEBUGtrueEnable debug output: "true" or "false"
APP_TIMEZONECETTimezone of the web server
APP_LOCALEde_DEDefault language of the user interface (de_DE, en_US)
APP_FALLBACK_LOCALEen_USFallback language (for any missing translations)
APP_FAKER_LOCALEde_DELaravel faker locale for testing data generation
APP_KEYEncryption key: base64 encoded 32-byte key (generate with php artisan key:generate)
APP_PREVIOUS_KEYSComma separated list of previously used encryption keys
APP_MAINTENANCE_DRIVERcacheMaintenance mode driver: "cache" or "file" - "cache" allows setting maintenance mode across multiple machines
APP_MAINTENANCE_STOREdatabaseMaintenance mode storage: "database" or "file"
AI_MENTION_HANDLEhawkiHandle to mention AI in group chats (without @ symbol)

Database Server

HAWKI uses a database to save chats and other data. For this a relation SQL database like MariaDB (MySQL) or Postgres should be used in production. For local development SQLite provides a zero-config default solution (but note that SQLite is single-user only and stores all data in a single file).

IMPORTANT: When using a database other than SQLite set DB_DATABASE to a sensible value. Because the default value in config/database.php is "laravel" which is less clear and could at least in theory already be in use by other applications.

VariableDefault ValueDescription
DB_CONNECTIONmysqlDatabase server type: "mysql", "sqlite", "mariadb", "pgsql", "sqlsrv" (see config/database.php)
DB_BACKUP_INTERVALdailyAutomatic database backup interval: "daily", "weekly", etc.
DB_URLDatabase connection URL (instead of host and port)
DB_HOSTlocalhostDatabase server host name
DB_PORT3306Database server port number
DB_SOCKETUnix domain socket instead of URL, host and port (MySQL and MariaDB only)
DB_DATABASEHAWKI2Database name (please change for your installation!)
DB_USERNAMErootUsername to access the database server
DB_PASSWORDPassword to access the database server
DB_CHARSETutf8mb4Character encoding of the database
DB_COLLATIONutf8mb4_unicode_ciDatabase collation (MySQL and MariaDB only)
MYSQL_ATTR_SSL_CASSL Certificate Authority file for MySQL SSL connections

HAWKI Profile Configuration

Configuration for the HAWKI AI assistant profile and system user.

Note: These migration attributes cannot be changed after running the database migration. If you want to change the HAWKI_AVATAR, place the file in /public/img folder and update the name here before migration.

VariableDefault ValueDescription
HAWKI_NAMEHAWKIDisplay name for the HAWKI AI assistant
HAWKI_USERNAMEHAWKIUsername for the HAWKI AI assistant
HAWKI_AVATARhawkiAvatar.jpgAvatar image filename (must be in /public/img directory)

AI Connection

Configuration for AI provider API keys and endpoints. Add your AI provider API keys here to enable AI functionality.

Note: For complete provider configuration and advanced model settings, refer to the HAWKI Documentation and the config/model_providers.php file.

VariableDefault ValueDescription
OPENAI_API_KEYOpenAI API key for accessing GPT models
GWDG_API_KEYGWDG API key for accessing academic cloud AI services
GOOGLE_API_KEYGoogle AI API key for accessing Gemini models
OPEN_WEB_UI_API_KEYOpenWebUI API key for local AI model access

File Converter Configuration

Configuration for document conversion services. Choose between HAWIK's built-in converter or GWDG's Docling service.

Note: To use GWDG Docling converter, you'll need a valid GWDG_API_KEY.

VariableDefault ValueDescription
FILE_CONVERTERhawki_converterConverter to use: "hawki_converter" or "gwdg_docling"
HAWKI_FILE_CONVERTER_API_URL127.0.0.1:8001/extractURL to the hosted HAWKI converter service
HAWKI_FILE_CONVERTER_API_KEY123456API key for the HAWKI converter service
GWDG_FILE_CONVERTER_API_URLhttps://chat-ai.academiccloud.de/v1/documents/convertURL to the GWDG Docling converter service

Filesystem Storage

Uploaded media files are typically stored on disk and served from an asset web server. However, to simplify the setup the uploaded files will be served by PHP by default, though this is not optimal for performance. Alternatively, Amazon S3, Nextcloud, or SFTP can be used.

NOTE: If you want to serve media files with your web server, choose "public" for FILESYSTEM_DISK. In this case make the server serve the files from the "storage/app/public" directory. The HTTP address must be your APP_URL followed by "/storage".

VariableDefault ValueDescription
FILESYSTEM_DISKlocalPrimary storage type: "local", "public", "s3", "nextcloud", "sftp"
STORAGE_DISKlocal_file_storageStorage disk for file attachments
AVATAR_STORAGEpublicStorage disk for user avatars
REMOVE_FILES_AFTER_MONTHS6Automatic file cleanup after X months

S3 Configuration

VariableDefault ValueDescription
S3_ACCESS_KEYS3 access key
S3_SECRET_KEYS3 secret key
S3_REGIONS3 region
S3_ENDPOINTS3 endpoint URL
S3_DEFAULT_BUCKETDefault S3 bucket name

Nextcloud Configuration

VariableDefault ValueDescription
NEXTCLOUD_BASE_URLBase URL of your Nextcloud instance
NEXTCLOUD_BASE_PATHBase path within Nextcloud for HAWKI files
NEXTCLOUD_USERNAMENextcloud username
NEXTCLOUD_PASSWORDNextcloud password or app token

SFTP Configuration

VariableDefault ValueDescription
SFTP_HOSTSFTP server hostname
SFTP_PORT22SFTP server port
SFTP_USERNAMESFTP username
SFTP_PASSWORDSFTP password
SFTP_BASE_PATHBase path on SFTP server

Session Configuration

These are essential Laravel default variables for session management, and they must be present and active to ensure proper session handling within the application.

VariableDefault ValueDescription
SESSION_DRIVERdatabaseSpecifies the session "driver" or handler used to store session data. Common choices include "file", "cookie", "database", etc. Typically, "database" is used if sessions are stored in the database.
SESSION_LIFETIME120The session lifetime in minutes. It determines how long a session remains active before it expires.
SESSION_ENCRYPTfalseIndicates whether session data should be encrypted. Accepts "true" or "false". When set to "true", it adds an extra layer of security by encrypting session data.
SESSION_PATH/Defines the path for which the session cookie is available. The default value is "/".
SESSION_DOMAINnullSpecifies the domain that the session cookie is available to. Use "null" to default to the current domain.
SESSION_EXPIRE_ON_CLOSEtrueDefines whether the session should expire when the browser is closed. Set to "true" to expire sessions on browser close, enhancing session security.

Event Broadcasting

Laravel contains an internal mechanism to broadcast events amongst servers. Normally you shouldn't need to change the settings here. Just use the values below and only change them if you really know what you are doing.

VariableDescription
BROADCAST_CONNECTIONBroadcasting mechanism: "reverb"
BROADCAST_DRIVERBroadcasting mechanism: "reverb"

For websocket connectivity Laravel provides a special server called Reverb. This must be set up for HAWKI since many features rely on real-time communication via web sockets.

VariableDefault ValueDescription
REVERB_HOST127.0.0.1 / hawki.comHostname of the Reverb server (set to your top-level domain for production)
REVERB_PORT8080 / 443Port number of the Reverb server (set to 443 for production)
REVERB_SERVER_HOST0.0.0.0Hostname of the Reverb server (set to 0.0.0.0 for production)
REVERB_SERVER_PORT8080Port number of the Reverb server (set to 8080 for production)
REVERB_SCHEMEhttp/httpsConnection protocol for the Reverb server: "http" or "https"
REVERB_APP_IDhawkiReverb application Id, can be anything you like?
REVERB_APP_SECRET123456789Password to access the Reverb server???
REVERB_APP_KEY123456789Secret key to access the Reverb server ???
REVERB_APP_PING_INTERVAL60Ping interval in seconds ???
REVERB_APP_MAX_MESSAGE_SIZE10000Maximum message size in bytes ???
REVERB_SCALING_ENABLEDfalse"true" or "false"
REVERB_SCALING_CHANNELreverb"reverb"

SSL Certificate Configuration

These environment variables are used to specify the SSL certificate and the corresponding private key that are essential for establishing secure TLS/SSL connections in certain broadcasting setups. This is particularly crucial when using Reverb or similar services with encrypted connections, ensuring data is securely transmitted over HTTPS.

VariableDescription
SSL_CERTIFICATESpecifies the path to your SSL certificate file. This certificate is used to authenticate and establish a secure connection between the server and the client.
SSL_CERTIFICATE_KEYSpecifies the path to the private key file corresponding to your SSL certificate. The key is required to confirm the identity of the server and encrypt the data being transmitted.

In the broadcasting configuration, these variables are used to configure the Guzzle HTTP client with appropriate SSL settings. By providing these files, you enable SSL/TLS encryption for broadcast services, enhancing the security of data in transit.

Vite Environment Configuration

These Vite environment variables are used to configure the front-end build system and its integration with services such as Reverb for real-time functionality within the application.

VariableDescription
VITE_APP_NAMERepresents the application's name used within the Vite build process. It is typically a direct reflection of the application's name set in the Laravel backend.
VITE_REVERB_APP_KEYThe Reverb application's key used for authentication. It should mirror the REVERB_APP_KEY variable set in the backend environment configuration.
VITE_REVERB_APP_CLUSTERThe cluster designation for the Reverb setup, which specifies which region or data center the real-time data will be managed through.
VITE_REVERB_HOSTDesignates the host for the Reverb service. This is typically set from the corresponding backend environment variable REVERB_HOST.
VITE_REVERB_PORTSpecifies the port that the Reverb service will run on, consistent with the setup from the backend environment variable REVERB_PORT.
VITE_REVERB_SCHEMEDefines the protocol scheme used by the Reverb service, such as "http" or "https", typically mirroring the REVERB_SCHEME variable from the backend.

Queue Worker Configuration

This configuration setting is used to specify the queue connection that should be used by the Laravel application. This is essential for managing asynchronous tasks such as sending emails, processing uploads, or any other task that can be handled in the background.

VariableDescription
QUEUE_CONNECTIONDefines the queue connection that the Laravel application will use. Options include "sync", "database", "redis", etc. The "database" connection is typically used to store jobs in a database table, which is useful for tracking, retrying, or monitoring queued jobs effectively.

Authentication and Authorization

Access to HAWKI is restricted for registered users. In a production environment, you usually want to connect to your LDAP directory, OpenID provider, or Shibboleth service to make HAWKI available to your staff and/or students. For simpler setups (e.g., a small project setup for a single course), you can use the built-in Test User Authentication mechanism. This allows defining a small set of pre-allocated users in the local database (set up in advance by you).

NOTE: If you want a small setup with fixed users but want to allow the users to change their passwords, you can install LDAP (https://github.com/lldap/lldap) on the same machine as HAWKI.

Supported authentication methods:

  • LDAP
  • OIDC (OpenID Connect)
  • Shibboleth

Set the AUTHENTICATION_METHOD variable to one of the following:

    AUTHENTICATION_METHOD="LDAP"
AUTHENTICATION_METHOD="OIDC"
AUTHENTICATION_METHOD="Shibboleth"

According to your authentication method, set the necessary variables as follows:

LDAP Configuration

VariableDefault ValueDescription
LDAP_CONNECTIONConfigure the LDAP connection. Currently only "default" is supported (see config/ldap.php)
LDAP_HOST"ldaps://...de"Hostname of the LDAP server
LDAP_PORT"636"Port number of the LDAP server
LDAP_USERNAMEDistinguished Name (DN) used for bind operation
LDAP_BIND_PW"xxx"Password to access the LDAP server
LDAP_BASE_DN"xxx"Base DN for the LDAP search
LDAP_TIMEOUTTimeout for LDAP queries in seconds
LDAP_SSLUse SSL to connect to the LDAP server. Not recommended: "true" or "false"
LDAP_TLSUse TLS to connect to the LDAP server. Recommended: "true" or "false"
LDAP_SASLUse SASL to connect to the LDAP server: "true" or "false"
LDAP_LOGGINGEnable logging of LDAP queries: "true" or "false"
LDAP_CACHEEnable caching of LDAP queries: "true" or "false"
LDAP_ATTRIBUTEScn,mail,employeetype,displaynameAttributes required for data extraction (Username, Email Address, Employee Type, Name)
LDAP_FILTER"(|(sAMAccountName=username)(mail=username))"Filter required for authentication based on Username
CACHE_DRIVERCache driver for caching LDAP queries: "file", ...
TEST_USER_LOGINtrue / falseReads the test users list in storage folder before LDAP. Set to true for allowing test access and add tester profile to the json file.

Shibboleth Configuration

VariableDefault ValueDescription
SHIBBOLETH_LOGIN_URL"Shibboleth.sso/Login?target=login.php"Path to the Shibboleth login handler "{$scheme}://{$_SERVER['HTTP_HOST']}/{$loginPath}{$loginPage}"
SHIBBOLETH_LOGOUT_URLURL for Shibboleth logout
SHIBBOLETH_NAME_VAR"displayname"Defined attribute on shibboleth server for name
SHIBBOLETH_EMPLOYEETYPE_VAR"email"Defined attribute on shibboleth server for employee type
SHIBBOLETH_EMAIL_VAR"employeetype"Defined attribute on shibboleth server for email address

OpenID Connect (OIDC) Configuration

VariableDefault ValueDescription
OIDC_IDP"https://xxx"URL of the OpenID Connect Identity Provider
OIDC_CLIENT_ID"xxx"Client ID for the OIDC application
OIDC_CLIENT_SECRET"xxx"Client secret for the OIDC application
OIDC_LOGOUT_URI"xxx"URI for OIDC logout
OIDC_SCOPESprofile,emailScopes define the level of access that the client is requesting from the authorization server.
OIDC_FIRSTNAME_VAR"firstname""firstname"
OIDC_LASTNAME_VAR"lastname""lastname"
OIDC_EMAIL_VAR"email""email"
OIDC_EMPLOYEETYPE_VAR"employeetype""employeetype"

External Communication Configuration

These settings control API access to HAWKI models and user token creation capabilities.

VariableDefault ValueDescription
ALLOW_EXTERNAL_COMMUNICATIONfalseMaster switch for external API access. When "true", API requests through external endpoints are permitted. When "false", all external API requests are blocked.
ALLOW_USER_TOKEN_CREATIONfalseControls whether users can create their own API tokens via the web interface. When "true", users can create, view, and revoke tokens through the profile page. When "false", only administrators can create tokens via command line tools.

Security Note: Both settings must be considered for managing API access:

  • ALLOW_EXTERNAL_COMMUNICATION=true and ALLOW_USER_TOKEN_CREATION=true: Users can create tokens and use the API
  • ALLOW_EXTERNAL_COMMUNICATION=true and ALLOW_USER_TOKEN_CREATION=false: Only admin-created tokens can use the API
  • ALLOW_EXTERNAL_COMMUNICATION=false: No API access regardless of token creation setting

Caching

The following settings allow use a dedicated cache server to speed up some often executed code paths like database queries and so on. Usually a very fast storage like Memcached or Redis is used for this. By default, the local database will be used, which should be fine for most installations. So only change these values if you really need to.

VariableDefault ValueDescription
CACHE_STOREdatabaseCache storage type: "array", "database", "file", "memcached", "redis", "dynamodb", "octane" (see config/cache.php)
CACHE_PREFIXPrefix for cache keys (by default calculated from the app name)

Database Cache Configuration

VariableDefault ValueDescription
DB_CACHE_TABLEcacheDatabase table name for cache storage
DB_CACHE_CONNECTIONDatabase connection for cache
DB_CACHE_LOCK_CONNECTIONDatabase connection for cache locks

Memcached Configuration

VariableDefault ValueDescription
MEMCACHED_HOST127.0.0.1Memcached server hostname
MEMCACHED_PORT11211Memcached server port
MEMCACHED_USERNAMEMemcached username (if required)
MEMCACHED_PASSWORDMemcached password (if required)
MEMCACHED_PERSISTENT_IDPersistent connection ID for Memcached

Redis Cache Configuration

VariableDefault ValueDescription
REDIS_CACHE_CONNECTIONcacheRedis connection name for cache
REDIS_CACHE_LOCK_CONNECTIONdefaultRedis connection for cache locks

DynamoDB Configuration

VariableDefault ValueDescription
DYNAMODB_CACHE_TABLEcacheDynamoDB table name for cache
DYNAMODB_ENDPOINTDynamoDB endpoint URL

Redis Server

Redis configuration is used for Reverb scaling (when REVERB_SCALING_ENABLED=true), caching, and optionally as a session store. Redis provides high-performance data storage for real-time features.

VariableDefault ValueDescription
REDIS_CLIENTphpredisPHP library used to access Redis: "phpredis" or "predis"
REDIS_HOSTlocalhostRedis server hostname
REDIS_PORT6379Redis server port number
REDIS_USERNAMERedis username (Redis 6.0+)
REDIS_PASSWORDRedis server password
REDIS_DB0Redis database number for normal data
REDIS_CACHE_DB1Redis database number for cache data
REDIS_CLUSTERredisRedis cluster configuration
REDIS_PREFIXPrefix for Redis keys (by default calculated from app name)

Email Configuration

The email configuration settings allow the application to send invitation emails to users, enabling them to invite other users to group chats. This feature is currently in beta testing. Ensure that the mail server settings are correctly configured to enable email functionality.

Note: For development and testing, you can use MAIL_MAILER=log to log emails instead of sending them.

VariableDefault ValueDescription
MAIL_MAILERsmtpThe mailer method to use for sending emails. Options: "smtp", "log", "array", "sendmail"
MAIL_HOSTThe hostname of the SMTP server used to send emails
MAIL_PORT587The port number used by the SMTP server. Use 465 for SSL or 587 for TLS
MAIL_USERNAMEThe username for authenticating with the SMTP server
MAIL_PASSWORDThe password for authenticating with the SMTP server
MAIL_ENCRYPTIONtlsThe encryption method used to secure email transmissions. Use 'ssl' for port 465 or 'tls' for port 587
MAIL_FROM_ADDRESSThe email address that will appear as the sender of the invitation emails
MAIL_FROM_NAMEHAWKIThe display name that will appear as the sender of the invitation emails

Encryption Configuration

For enhanced security, HAWKI utilizes individual salts for each component to ensure that data is encrypted uniquely. While not mandatory, using unique hash keys for each component is recommended to maximize the security of user data, invitations, AI components, passkeys, and backups.

Security Note: All salt values should be base64-encoded random strings. Generate new salts for each installation to ensure maximum security.

VariableDefault FormatDescription
USERDATA_ENCRYPTION_SALTbase64:someRandomSalt==The salt used specifically for encrypting user data
INVITATION_SALTbase64:someOtherRandomSalt==The salt used for encrypting invitations data
AI_CRYPTO_SALTbase64:someVeryCoolSalt==Used to generate a derived key for the AI messages in the group chat
PASSKEY_SALTbase64:somePrettyAwesomeSalt==The salt used for encrypting passkey data, contributing to robust password and credential security
BACKUP_SALTbase64:someLegendarySalt==The salt used to encrypt backup data, ensuring their security during storage and transfer
VariableDescription
IMPRINT_LOCATIONThe URL to your organization imprint page.